Thumb

HTML ‘div’ Tag

1/29/2020 6:19:02 AM

In the html div tag are more important for design the web page. Basically, when we design the web page then we write code and div element are more use the create the architecture or layout. Div tag have some specific quality contain by default. this tag 100% width but no height. If we want to set the height then we use the style attribute and we define the all style. Also, when we write div style it looks like square box. Now given bellow the div tag example code and explain the code:

<!DOCTYPE html>
<html>
      <head>
      	<title>This is HTML</title>
      </head>
      <body> 
<div>
    <div style="border:1px solid black;height: 180px">
      <h2 style="text-align: center;">Web site head</h2>
    </div>
      <div style="border:1px solid black;height: 280px;width: 49%;float: left;"></div>
      <div style="border:1px solid black;height: 280px;width: 49%;float: right;"></div>
    <div style="clear:both"></div>
    <div style="border:1px solid black;height: 80px"></div>
</div>
      </body>
</html>

In this code we see the div tag and see the layout. When we create layout, we use the div tag and also this div tag under use the style attribute and set the style property.